Colors {
    Colors.black = rgba(0.0, 0.0, 0.0, 1.0)
    Colors.gray = rgba(0.8, 0.8, 0.8, 1.0)
    Colors.darkgray = rgba(0.6, 0.6, 0.6, 1.0)
    Colors.red = rgba(1.0, 0.0, 0.0, 1.0)
    Colors.yellow = rgba(1.0, 1.0, 0.0, 1.0)
    Colors.orange = rgba(1.0, 0.6, 0.0, 1.0)
    Colors.lightorange = rgba(1.0, 0.6, 0.0, 0.25)
    Colors.green = rgba(0.0, 1.0, 0.0, 1.0)
    Colors.blue = rgba(0.0, 0.0, 1.0, 1.0)
    Colors.lightblue = rgba(0.0, 0.0, 1.0, 0.25)
    Colors.cyan = rgba(0.0, 1.0, 1.0, 1.0)
    Colors.purple = rgba(0.5, 0.0, 0.5, 1.0)
    Colors.white = rgba(1.0, 1.0, 1.0, 1.0)
    Colors.none = rgba(0.0, 0.0, 0.0, 0.0)
    Colors.lightblue2 = rgba(0.82, 0.88, 0.94, 1.0)
}

global {
       global.pi_over_four = 0.78
       global.half_pi = 1.57
       global.pi = 3.14
       global.two_pi = 6.28
}

Point p {
      p.shape = Circle {
      	      x = 0.0
	      y = 0.0
	      r = 10.0
	      color = Colors.red
	      strokeWidth = 0.0
      }
}

Set X {
    X.dx = OPTIMIZED
    X.dy = OPTIMIZED
    X.angle = OPTIMIZED

    -- Why does introducing this useless variable "improve" the optimization?
    -- X.thing = OPTIMIZED

    X.shape = RectangleTransform {
    	x = 0.0 -- OPTIMIZED
	y = 0.0 -- OPTIMIZED
	sizeX = 200.0
	sizeY = 100.0
	rotation = 0.0 -- OPTIMIZED
        strokeWidth = 0.0
	transform = andThen(rotate(X.angle), translate(X.dx, X.dy))
    }

    -- TODO: this should get the finalX
    -- X.text = Text {
    --   string = X.label
    --   x = X.shape.x 
    --   y = X.shape.y
    -- }

    -- LOCAL.layering  = X.shape below X.text
}

Set `A` {
    override `A`.shape.color = setOpacity(Colors.red, 0.5)
}

Set `B` {
    -- override `B`.shape.x = -100.0
    -- override `B`.shape.y = -200.0
    override `B`.shape.sizeX = 100.0
    override `B`.shape.sizeY = 200.0
    override `B`.shape.color = setOpacity(Colors.green, 0.5)
}


-- Set `C` {
--     override `C`.shape.x = 0.0
--     override `C`.shape.y = 0.0
--     override `C`.shape.rotation = 0.0
--     override `C`.shape.color = setOpacity(Colors.blue, 0.5)
-- }

Set `A`; Set `B` {
   LOCAL.objFn = encourage boundaryIntersect(`A`.shape, `B`.shape)
}
